require 'include.rb'

module SandBox
  
  app = HtmlApplication.new()
  app.router.plug Application, '/'
  app.router.plug Demo::DemoApplication, '/demos'
  app.router.plug CodeGraphs::Application, '/code_graphs'

  app.router.plug CodeGraphs::DirectoryPicker, '/test'

  adapter = RackAdapter.new(app)

  rack_app = Rack::Builder.new {
    use Rack::CommonLogger 
    use Rack::ShowExceptions
    map "/" do
      use Rack::Lint
      run adapter
    end
  }  
  
  sessioned = Rack::Session::Pool.new(rack_app,
    :key => 'dm.session',
    #:domain => '127.0.0.1', # if you want to force the domain
    :path => '/',
    :expire_after => 1*24*60*60
  )
  
  #employ any rack handler you wish
  handler = Rack::Handler::Mongrel
  handler.run(sessioned, {
      #:Port => 8081, :Host => '127.0.0.1'
      # to show your friends use these args instead:
      :Port => 80, :Host => '0.0.0.0'
    })
  
end


